﻿using System;
using System.Collections.Generic;
using System.IO;

namespace TSites.Service.Interfaces
{
	public abstract class BasedFileProcessor<T>
	{
		#region General methods

		public void Copy(string sourceFileName, string destFileName, bool overwrite = true)
		{
			try
			{
				File.Copy(sourceFileName, destFileName, overwrite);
			}
			catch (Exception)
			{
				throw;
			}
		}

		public void Delete(string path)
		{
			try
			{
				if (File.Exists(path))
				{
					File.Delete(path);
				}
			}
			catch (Exception)
			{
				throw;
			}
		}
		
		#endregion

		#region Abstract methods

		public abstract List<T> Read(string path);
		public abstract void Write(string path, T[] content);
		
		#endregion
	}
}
